ige.controller('MainNavController', ['$scope', '$state', 'EventBus', function ($scope, $state, EventBus) {
    $scope.currentToolbar = function (name) {
        return name == $state.$current.name;
    };

    $scope.addDepartment = function () {
        $state.go('MainNav.AddDepartment');
    };

    $scope.backDepartment = function () {
        $state.go('MainNav.Department');
    };
    $scope.department = {
        keyword: '',
        id: '',
        keywordSearch: function () {
            EventBus.fire({
                type: "department.keywordSearch",
                data: $scope.department
            });
        }
    };

    $scope.addUser = function () {
        $state.go('MainNav.AddSystemUser');
    };

    $scope.backUser = function () {
        $state.go('MainNav.SystemUser');
    };
    $scope.user = {
        keyword: '',
        id: '',
        keywordSearch: function () {
            EventBus.fire({
                type: "systemUser.keywordSearch",
                data: $scope.user
            });
        }
    };


    $scope.RewardEmployee = function (ent) {
        EventBus.fire({
            type: "Employee.RewardEmployee",
            data: ent
        });
    };

    $scope.addEmployee = function () {
        $state.go('MainNav.AddEmployee');
    };

    $scope.caclTax = function () {
        EventBus.fire({
            type: "Employee.RewardEmployees"
        });
    };

    $scope.DownLoadRewardEmployee = function () {
        EventBus.fire({
            type: "Employee.DownloadRewardEmployees"
        });
    };

    $scope.backEmployee = function () {
        $state.go('MainNav.Employee');
    };
    $scope.Employee = {
        keyword: '',
        id: '',
        keywordSearch: function () {
            EventBus.fire({
                type: "Employee.keywordSearch",
                data: $scope.Employee
            });
        }
    };

    $scope.addTaxSetting = function () {
        $state.go('MainNav.AddTaxSetting');
    };

    $scope.backTaxSetting = function () {
        $state.go('MainNav.TaxSetting');
    };

}]);